package com.maoxs;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;

@SpringBootApplication
public class SpringbootExceptionApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootExceptionApplication.class, args);
    }

//    @Bean
//    public ErrorPageRegistrar errorPageRegistrar() {
//        return new MyErrorPageRegistrar();
//    }
//   //一些复杂的错误处理
//    private static class MyErrorPageRegistrar implements ErrorPageRegistrar {
//        @Override
//        public void registerErrorPages(ErrorPageRegistry registry) {
//            registry.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "具体你的path"));
//            registry.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "具体你的path"));
//        }
//    }
}


